<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>在线预订 -{$item['iname']}</title>
    <meta name="viewport"
          content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link href="{MON_ORDER_RES}css/hotels.css" rel="stylesheet" type="text/css">
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
    <script src="{MON_ORDER_RES}js/mobiscroll.core.js" type="text/javascript"></script>
    <script src="{MON_ORDER_RES}js/mobiscroll.jqm.js" type="text/javascript"></script>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css?v=1.0" />
    <link href="{MON_ORDER_RES}css/mobiscroll.core.css?v=1.0" rel="stylesheet" type="text/css" />
    <link href="{MON_ORDER_RES}css/mobiscroll.jqm.css?v=1.0" rel="stylesheet" type="text/css" />

    <link rel="stylesheet" type="text/css"
          href="{MON_ORDER_RES}/css/sweet-alert.css">
    <script type="text/javascript" src="{MON_ORDER_RES}/js/sweet-alert.min.js"></script>
</head>


<body id="hotelsorder">
<div class="banner">
    <div id="wrapper">
        <div id="scroller">
            <ul id="thelist">
                <li><p>{$item['ititle']}</p><a href="{$item['ititle_url']}"><img
                        src="{php echo MonUtil::getpicurl($item['ititle_pg'])}"/></a></li>
            </ul>
        </div>
    </div>
    <div id="nav">
        <div id="prev" onClick="myScroll.scrollToPage('prev', 0,400,1);return false">&larr; prev</div>
        <ul id="indicator">
            <li>1</li>
        </ul>
        <div id="next" onClick="myScroll.scrollToPage('next', 0);return false">next &rarr;</div>
    </div>
    <div class="clr"></div>
</div>
<div class="cardexplain"><!--商家房价及类型-->

    <ul class="round">
        <li class="title mb"><span class="none">支付订单信息</span></li>
        <li class="nob">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tr>
                    <th>预订人</th>
                    <td><input name="uname" type="text" class="px" id="uname" value="{$order['uname']}" readonly>
                    </td>
                </tr>
            </table>
        </li>
        <li class="nob">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tr>
                    <th>联系电话</th>
                    <td><input name="utel" type="text" class="px" id="utel" value="{$order['utel']}" readonly>
                    </td>
                </tr>
            </table>
        </li>
        <li class="nob">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tr>
                    <th>预定时间</th>
                    <td> <input type="text" data-role="datebox" id="ordertime" name="ordertime" value="{php echo date("Y-m-d", $order['ordertime'])}" readonly/>
                    </td>
                </tr>
            </table>
        </li>
        <li class="nob">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tr>
                    <th>类型</th>
                    <td><input class="px" value="{$item['iname']}" type="text" readonly></td>
                </tr>
            </table>
        </li>

        <li class="nob">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tr>
                    <th>预订数量</th>
                    <td><input class="px" value="{$order['ordernum']}" type="text" name="ordernum" id="ordernum" readonly></td>
                </tr>
            </table>
        </li>

        <li class="nob">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tr>
                    <th>支付单价</th>
                    <td class="userinfo price" id="price2">￥ {$order['o_xprice']}</td>
                </tr>
            </table>
        </li>
        <li class="nob">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="kuang">
                <tr>
                    <th>支付金额</th>
                    <td class="userinfo price2" id="price3">￥{$order['zf_price']}</td>
                </tr>
            </table>
        </li>
    </ul>

    <div class="footReturn">
        {if $order['status']==$this::$STATUS_UNPAY}
           <input type="button" id="pay" value="立即支付" onclick="callpay()"/>
        {/if}
        {if $order['status']==$this::$STATUS_PAY_OVER}
           <input type="button"  value="已付款"/>
        {/if}
    </div>

</div>


<script type="text/javascript">

         var payEnable = true;




    {if $order['status']==$this::$STATUS_UNPAY}
    //调用微信JS api 支付
    function jsApiCall() {

        WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
        <?php echo $jsApiParameters; ?>,
        function (res) {
            if(res.err_msg == "get_brand_wcpay_request:ok" ) {

                $.post("{php echo $this->createMobileUrl('PaySuccess',array('oid'=>$order['id']),true)}", function(res){

                },'json');

                swal({
                            title: "提示",
                            text: "恭喜您支付成功!",
                            type: "success",
                            showCancelButton: false,
                            confirmButtonColor: "#DD6B55",
                            confirmButtonText: "确定",
                            closeOnConfirm: true },
                        function(){
                           window.location.reload();
                            payEnable = false;
                        });


            } else{
               // alert(res.err_code+res.err_desc+res.err_msg);
            }


        });
    }

    function callpay() {

        if (!payEnable) {
            return ;
        }
        //alert("卧槽");
        if (typeof WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        } else {
            jsApiCall();
        }
    }



    {/if}

</script>


</body>
</html>